/**
 * 
 */
package com.estock.web.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.estock.common.model.security.Index;
import com.estock.common.util.support.ESLogger;
import com.estock.web.service.IndexService;

/**
 * @author richard
 * 
 */
@Controller
public class IndexController {

	protected final ESLogger logger = ESLogger.getLogger(IndexController.class);
	
	@Resource
	IndexService indexService; 
	public IndexService getIndexService() {
		return indexService;
	}
	
	
	//////// Return View

	//////// Return Json
	
	@RequestMapping(value="getIndexNum.es", method = RequestMethod.GET)
	@ResponseBody
	public int getIndexNum() throws Exception {
		logger.info("start getting all indexes number.");
		
		return getIndexService().getIndexNum();
	}
	
	@RequestMapping(value="findAllIndexes.es", method = RequestMethod.GET)
	@ResponseBody
	public List<Index> findAllIndexes() throws Exception {
		logger.info("start finding all indexes.");
		
		return getIndexService().findAllIndexes();
	}
	
}
